package com.iphanta.community.tags.web;

import com.iphanta.community.common.entity.DataResult;
import com.iphanta.community.common.utils.ResultUtils;
import com.iphanta.community.tags.service.TagsService;
import com.iphanta.community.tags.traffic.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 标签
 *
 * @author 墨声 E-mail: zehong.hongframe.huang@gmail.com
 * create time: 3/7/22 2:22 PM
 */
@RestController
@RequestMapping("community/tagCodes/")
public class TagsController {

    @Autowired
    private TagsService tagsService;

    /**
     * 标签列表
     *
     * @param request
     * @return
     */
    @PostMapping("list")
    public DataResult<TagsResponse> list(@Validated @RequestBody TagsV1Request request) {
        return ResultUtils.SUCCESS.result(tagsService.list(request));
    }

    /**
     * 标签列表
     *
     * @param request
     * @return
     */
    @PostMapping("tags")
    public DataResult<TagsResponse> tags(@RequestBody TagsRequest request) {
        return ResultUtils.SUCCESS.result(tagsService.tags(request));
    }

}
